<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$item=$this->plugin_setting('setting');
if($_RQ['op']=='main'){
	$id=$_RQ['id'];
	if(!$id){
		exi('请先选择摄像头','error');
	}
	$room=pdo_get('jy_live_list',array('id'=>$id));
	$info=$this->geturl($room['number']);	
	$room['image']=tomedia($room['image']);
	$return['info']=$info;
	$hd=$_RQ['hd'];
	if($hd){
		if($hd==2){
			$room['now']=2;
			$info['hls']=$info['hlsHd'];
		}else{
			$room['now']=1;
		}
	}else{
		if($room['hd']==2){
			$info['hls']=$info['hlsHd'];
		}
		if($room['hd']=3){
			$room['now']=1;
		}
	}
	$return['room']=$room;
	$return['setting']=$item;
	$return['item']=array(
		'id'=>$room['id'],
		'video'=>$info['url'],
		'image'=>$room['image'],
	);
	$return['wsConfig'] =array('isIos' => is_ios(),'isMobile'=>1);
	include $this->template('room');
	//exi($return);
}
if($_RQ['op']=='open'){
	$id=$_RQ['id'];
	$room=pdo_get('jy_live_list',array('id'=>$id));
	$source=$room['number'].':'.$room['line'];
	$this->open($source);
	exi('开启成功','','/room/main/id='.$id);
}
if($_RQ['op']=='close'){
	$id=$_RQ['id'];
	$room=pdo_get('jy_live_list',array('id'=>$id));
	$source=$room['number'].':'.$room['line'];
	$this->close($source);
	exi('关闭成功','','/room/list');
}
?>